package user;

import java.security.SignatureException;

import org.apache.axis2.AxisFault;

import common.Message;
import common.Settings;
import common.UserRPCClient;

public class TestUsers {

	
	/**
	 * @param args
	 * @throws AxisFault 
	 */
	public static void main(String[] args) throws AxisFault {

		UserRPCClient srv = new UserRPCClient(Settings.SERVER_URI); 
		CUser cuser = new CUser();
		try {
			cuser.postMessage("Msg Dan 3");
                    
		} catch (SignatureException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		
		Class[] returnTypes = new Class[]{Message[].class};
		
		Message[] msgsFromSrv = (Message[])(srv.wsCall(returnTypes, Settings.SERVER_NS, "getMessages", null)[0]);
		for (int i = 0; i < msgsFromSrv.length; i++) {
			System.out.println("Msg #" + i + ": " + msgsFromSrv[i].getClientID() + "- " + msgsFromSrv[i].getContentString());
		}

		
	}

}
